package com.tedu.show.menus;

import com.tedu.controller.GameController;

import javax.swing.*;
import java.awt.*;

/**
 * 关卡选择界面
 */
public class LevelSelectionScreen extends BaseScreen {
    public LevelSelectionScreen() {
        super("game_start");

        // 关卡1按钮
        JButton level1Button = new JButton("关卡 1");
        level1Button.setBounds(300, 290, 200, 50);
        level1Button.addActionListener(e -> {
            GameController.selectedLevel = "map1"; // 设置选择的关卡
            GameController.switchPanel(GameController.GameState.IN_GAME);
        });
        this.add(level1Button);

        // 关卡2按钮
        JButton level2Button = new JButton("关卡 2");
        level2Button.setBounds(300, 350, 200, 50);
        level2Button.addActionListener(e -> {
            GameController.selectedLevel = "map2";
            GameController.switchPanel(GameController.GameState.IN_GAME);
        });
        this.add(level2Button);

        // 关卡3按钮
        JButton level3Button = new JButton("关卡 3");
        level3Button.setBounds(300, 410, 200, 50);
        level3Button.addActionListener(e -> {
            GameController.selectedLevel = "map3";
            GameController.switchPanel(GameController.GameState.IN_GAME);
        });
        this.add(level3Button);

        // 返回按钮
        JButton backButton = new JButton("返回");
        backButton.setBounds(300, 470, 200, 50);
        backButton.addActionListener(e -> GameController.switchPanel(GameController.GameState.SELECTION));
        this.add(backButton);
    }
}
